//
//  CCSceneManager.cpp
//  ShadowMapping
//
//  Created by Daniel Corleone on 19/6/14.
//  Copyright (c) 2014年 iCloverStudio. All rights reserved.
//

#include "CCSceneManager.h"
#include "CCCamera.h"
#include "CCMeshBase.h"

BECO_NAMESPACE_BEGIN

SceneManager* SceneManager::instance = 0;

SceneManager::SceneManager()
	: Node(eSceneManager, "SceneManager")
{
}

SceneManager::SceneManager(Node* parent)
	: Node(eSceneManager, parent, "SceneManager")
{
    
}

SceneManager::~SceneManager()
{
}

SceneManager*
SceneManager::Instance() {
    if (0 == instance) {
        instance = new SceneManager(0);
    }
    return instance;
}

Camera*
SceneManager::CreateCamera(Camera::Camera_Type _camType, const String& name)
{
    Camera* camRet = 0;
    do {
        camRet = new Camera(SceneManager::Instance(), name, _camType);
        

		addIntoNodeCollection(camRet);

    } while (false);
    return camRet;
}

Mesh*
SceneManager::CreateMesh(const String& name)
{
	Mesh* meshRet = 0;
	do {
		assert(name.length() != 0);

		this->addIntoNodeCollection(meshRet);

	} while (false);
	return meshRet;
}

void
SceneManager::Update(const Real timeInterval)
{
	Node::Update(timeInterval);

#pragma message("For updating logic")

	return;
}

void 
SceneManager::Render(const Real timeInterval) {
	Node::Render(timeInterval);

#pragma message("For Render logic")

	return;
}

///
void
SceneManager::addIntoNodeCollection(Node* node4Add) {
	do {
		if (node4Add == 0)
			break;

#pragma message("Adding logic here.")

	} while (false);
	return;
}

void
SceneManager::removeFromNodeCollection(Node* node4Remove) {
	do {
		if (node4Remove == 0)
			break;

#pragma message("Removing node here.")

	} while (false);
	return;
}

Boolean 
SceneManager::isNodeExisted(const String& nodeName)
{
	return false;
}

BECO_NAMESPACE_END
